﻿@page
@using WB.UI.Designer.Utils
@model WB.UI.Designer.Areas.Admin.Pages.UserDetailsModel

@{
    ViewBag.Title = "User details: "  + Model.Account.UserName;
}
<div id="edit-form">
    <h1>
        Account: @Model.Account.UserName
        <a class="btn btn-default" asp-page="./EditUser" asp-route-id="@Model.Account.Id">
            Edit
        </a>
    </h1>
    <div class="form-group">
        <b>Email:</b> @Model.Account.Email
    </div>
    <div class="form-group">
        <b>Full name:</b> @Model.Account.FullName
    </div>
    <div class="form-group">
        <input type="checkbox" asp-for="Account.IsApproved" id="is-approved" disabled class="wb-checkbox" />
        <label for="is-approved">
            <span></span>Is Approved
        </label><br />
    </div>
    <div class="form-group">
        <input type="checkbox" asp-for="Account.IsLockedOut" id="is-locked" disabled class="wb-checkbox" />
        <label for="is-locked">
            <span></span>Is Locked Out
        </label><br />
    </div>
    <div class="form-group">
        <input type="checkbox" asp-for="Account.CanImportOnHq" id="can-import" disabled class="wb-checkbox" />
        <label for="is-locked">
            <span></span>Can import on HQ
        </label><br />
    </div>
    <h4>Owned questionnaires:</h4>
    <table class="table table-content ">
        <thead>
            <tr>
                <th>
                    Title
                </th>
                <th>
                    Last modified
                </th>
                <th>
                    Created date
                </th>
            </tr>
        </thead>
        <tbody>
        @if(Model.OwnedQuestionnaires != null)
        {
            foreach (var listViewModel in Model.OwnedQuestionnaires)
            {
                <tr class="@(listViewModel.IsDeleted ? "deleted" : "")">
                    <td class="search-value">
                        <a asp-controller="Questionnaire" asp-action="Details" asp-route-id="@listViewModel.Id" target="_blank">
                            @listViewModel.Title
                        </a>
                    </td>
                    <td class="date">
                        @listViewModel.LastEntryDate.ConvertToLocalAndFormatDate()
                    </td>
                    <td class="date">
                        @listViewModel.CreationDate.ConvertToLocalAndFormatDate()
                    </td>
                </tr>
            }
        }
        </tbody>
    </table>
    <h4>Shared questionnaires:</h4>
    <table class="table table-content ">
        <thead>
            <tr>
                <th>
                    Title
                </th>
                <th>
                    Last modified
                </th>
                <th>
                    Created date
                </th>
            </tr>
        </thead>
        <tbody>
        @if(Model.SharedQuestionnaires!= null)
        {
            foreach (var listViewModel in Model.SharedQuestionnaires)
            {
            <tr class="@(listViewModel.IsDeleted ? "deleted" : "")">
                <td class="search-value">
                    <a asp-controller="Questionnaire" asp-action="Details" asp-route-id="@listViewModel.Id" target="_blank">
                        @listViewModel.Title
                    </a>
                </td>
                <td class="date">
                    @listViewModel.LastEntryDate.ConvertToLocalAndFormatDate()
                </td>
                <td class="date">
                    @listViewModel.CreationDate.ConvertToLocalAndFormatDate()
                </td>
            </tr>
            }
        }
        </tbody>
    </table>
</div>
